//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Diagnostics.Contracts;
using System.IO;

namespace OpenLS.Spreadsheet.Formats.Biff.Records
{
    internal class ChartLineRecord : ChartBiffRecord
    {
        private bool fStacked;
        private bool f100;
        private bool fHasShadow;

        internal override BiffRecordType RecordType
        {
            get { return BiffRecordType.Line; }
        }

        internal override void WriteContent(BiffWriterWorkbookContext context)
        {
            context.Write(this.Num);
        }

        protected ushort Num
        {
            get {
                ushort result = 0;
                if (fStacked) result |= 0x01;
                if (f100) result |= 0x02;
                if (fHasShadow) result |= 0x04;
                return result;
            }
        }

        protected override void ReadContent(BiffReaderContext context, int length)
        {
            ushort num = context.ReadUInt16();
            this.fStacked = (num & 1) == 1;
            this.f100 = (num & 2) == 2;
            this.fHasShadow = (num & 4) == 4;
            Contract.Assert(this.Num == num);
        }







    }
}